package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.app.AppUploadPassRecordDTO;
import com.itlong.cloud.POJO.DTO.property.*;
import com.itlong.cloud.POJO.PO.DeviceCloudIntercomInfoPO;
import com.itlong.cloud.POJO.PO.RoomInfoPO;
import com.itlong.cloud.POJO.VO.property.*;
import com.itlong.cloud.app.dao.IAppDevicePassRecordDao;
import com.itlong.cloud.equip.property.ICloudIntercomServiceClient;
import com.itlong.cloud.property.service.ICloudIntercomService;
import com.itlong.cloud.utils.page.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <desc>
 * 云对讲设备管理服务暴露接口实现
 * </desc>
 *
 * @createDate 2017-11-15.
 */
@RestController
public class CloudIntercomServiceResource implements ICloudIntercomServiceClient {
    @Autowired
    ICloudIntercomService iCloudIntercomService;

    @Autowired
    IAppDevicePassRecordDao iAppDevicePassRecordDao;


    /**
     * <desc>
     * 判断sn存在性
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2018-01-02
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/checkSnExist", method = {RequestMethod.POST})
    public Integer checkSnExist(@RequestParam("sn") String sn) throws Exception {
        return iCloudIntercomService.checkSnExist(sn);
    }

    /**
     * <desc>
     * 根据sn查询云对讲设备业务服务器信息
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-15
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceServer", method = {RequestMethod.POST})
    public CloudIntercomDeviceVO getDeviceServer(@RequestParam(name = "sn") String sn) throws Exception {
        CloudIntercomDeviceVO result = iCloudIntercomService.getCloudIntercomServer(sn);
        return result;
    }

    /**
     * <desc>
     * 设备端连接云端认证
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-15
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/login", method = {RequestMethod.POST})
    public CloudIntercomDeviceVO cloudIntercomLogin(@RequestParam(name = "sn") String sn,
                                                    @RequestParam(value = "newDevice", required = false) String newDevice) throws Exception {
        return iCloudIntercomService.cloudIntercomLogin(sn, newDevice);
    }

    /**
     * <desc>
     * 从缓存中获取云对讲服务信息
     * <desc/>
     *
     * @param token 设备token
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-16
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/retrieve", method = {RequestMethod.POST})
    public CloudIntercomDeviceCacheVO retrieve(@RequestParam(name = "token") String token) throws Exception {
        return iCloudIntercomService.retrieve(token);
    }

    /**
     * <desc>
     * 设备端上电请求云端获取license与md5串
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/20
     */
    @RequestMapping(path = "smartCommunity/interface/device/getLicense", method = RequestMethod.POST)
    public DeviceCloudIntercomInfoPO getLicense(@RequestParam("sn") String sn) {
        return iCloudIntercomService.getLicense(sn);
    }

    /**
     * <desc>
     * 云端接收QQ与TinyID映射信息
     * </desc>
     *
     * @param sn         设备唯一码
     * @param din
     * @param qqTinyDTOS 映射信息列表json
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/20
     */
    @RequestMapping(path = "smartCommunity/interface/device/pushQQAndTinyId", method = RequestMethod.POST)
    public List<PropertyCloudQqTinyDTO> pushQQAndTinyId(@RequestParam("sn") String sn,
                                                        @RequestParam("din") String din,
                                                        @RequestBody List<PropertyCloudQqTinyDTO> qqTinyDTOS) throws IOException {
        return iCloudIntercomService.pushQQAndTinyId(sn, din, qqTinyDTOS);
    }

    /**
     * <desc>
     * 云端接收设备端的通行记录
     * </desc>
     *
     * @param sn
     * @param type             记录类型 4表示电话呼叫，7表示设备上密码通行
     * @param deviceRecordJson json映射信息
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/21
     */
    @RequestMapping(path = "smartCommunity/interface/device/pushDeviceRecord", method = RequestMethod.POST)
    @Override
    public Integer pushDeviceRecord(@RequestParam("sn") String sn,
                                    @RequestParam("type") Integer type,
                                    @RequestParam("deviceRecordJson") String deviceRecordJson,
                                    @RequestParam("deviceType") String deviceType) throws Exception {
        return iCloudIntercomService.pushDeviceRecord(sn, type, deviceRecordJson, deviceType);
    }


    /**
     * <desc>
     * 获取云对讲设备服务权限信息
     * <desc/>
     *
     * @param getDTO 获取云对讲服务权限DTO
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-16
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceServeRoomsByPage", method = {RequestMethod.POST})
    public Page<CloudIntercomDeviceAuthVO.Room> getDeviceServeRoomsByPage(@RequestBody CloudIntercomDeviceAuthGetDTO getDTO) throws Exception {
        return iCloudIntercomService.getDeviceServeRoomsByPage(getDTO);
    }

    /**
     * <desc>
     * 获取房间下的住户信息
     * <desc/>
     *
     * @param roomIds 房间id
     * @return
     * @author Chunjian.G
     * @createDate 2018-01-29
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getUsersByRoomIds", method = {RequestMethod.POST})
    public List<CloudIntercomDeviceAuthVO.RoomUser> getUsersByRoomIds(@RequestParam("roomIds") String roomIds, @RequestParam("sn") String sn) throws Exception {
        return iCloudIntercomService.getUsersByRoomIds(roomIds, sn);
    }

    /**
     *<desc>
     * 获取单元id
     *</desc>
     *
     * @Author  chengshican
     * @Date   2020-12-08 13:51
     * @Param
     * @Return
     * @Exception
     *
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getUnitIdByRoomInfoId", method = {RequestMethod.POST})
   public RoomInfoPO getUnitIdByRoomInfoId(@RequestParam("roomId") String roomId){
        return iCloudIntercomService.getUnitIdByRoomInfoId(roomId);
}

    /**
     * <desc>
     * 通过云对讲设备的唯一标识查询设备所在地址
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2021-01-27 9:55
     * @Param deviceUnique 设备唯一标识符
     * @Return buildId 楼栋id   unitId  单元id
     * @Exception
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getUnitIdByDeviceUnique", method = {RequestMethod.POST})
    public  List<Map<String, String>> getUnitIdByDeviceUnique(@RequestParam("deviceUnique") String deviceUnique) throws Exception {
        return iCloudIntercomService.getUnitIdByDeviceUnique(deviceUnique);
    }


    /**
     * <desc>
     * 通过云门禁设备的唯一标识查询设备所在地址
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2021-01-27 9:55
     * @Param deviceUnique 设备唯一标识符
     * @Return buildId 楼栋id   unitId  单元id
     * @Exception
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getUnitIdByEntranceDeviceUnique", method = {RequestMethod.POST})
    public  List<Map<String, String>> getUnitIdByEntranceDeviceUnique(@RequestParam("deviceUnique") String deviceUnique) throws Exception {
        return iCloudIntercomService.getUnitIdByEntranceDeviceUnique(deviceUnique);
    }

    /**
     * <desc>
     * 根据地址获取电梯设备信息
     * </desc>
     *
     * @param address
     * @Author chengshican
     * @Date 2021-01-27 9:55
     * @Param buildId 楼栋id   unitId  单元id
     * @Return deviceUnique 电梯设备的唯一标识符    liftDoorType 正背门信息  （正背门 1正门 0背门）
     * @Exception
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getElevatorLiftDoorTypeListByAddress", method = {RequestMethod.POST})
    public List<CloudElevatorVO> getElevatorLiftDoorTypeListByAddress(Map<String, String> address) throws Exception {
        return iCloudIntercomService.getElevatorLiftDoorTypeListByAddress(address);
    }

    /**
     * <desc>
     * 获取云对讲设备附加信息
     * <desc/>
     *
     * @param deviceUnique 云对讲设备唯一码
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-20
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceOtherInfo", method = {RequestMethod.POST})
    public CloudIntercomOtherInfoVO getDeviceOtherInfo(@RequestParam("deviceUnique") String deviceUnique) throws Exception {
        return iCloudIntercomService.getDeviceOtherInfo(deviceUnique);
    }


    /**
     * <desc>
     * 云端接收H5端上传的通行记录
     * </desc>
     *
     * @param sn               云对讲sn
     * @param type             2表示QQ呼叫 3表示用户本人通行
     * @param deviceRecordJson json数据
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/22
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/pushQqRecord", method = RequestMethod.POST)
    public Integer pushQqRecord(@RequestParam("sn") String sn,
                                @RequestParam("type") Integer type,
                                @RequestParam("deviceRecordJson") String deviceRecordJson) throws Exception {
        return iCloudIntercomService.pushQqRecord(sn, type, deviceRecordJson);
    }

    /**
     * <desc>
     * 云端接收PAD人脸认证的通行记录
     * </desc>
     *
     * @param appUploadPassRecordDTO 通行记录信息
     * @return
     * @author Qiang.S
     * @createDate 2018/05/16
     */
    @Override
    @RequestMapping(path = "/smartCommunity/interface/device/pushPadFaceRecord", method = RequestMethod.POST)
    public Integer pushPadFaceRecord(@RequestBody AppUploadPassRecordDTO appUploadPassRecordDTO) throws Exception {
        return iCloudIntercomService.pushPadFaceRecord(appUploadPassRecordDTO);
    }

    /**
     * <desc>
     * 校验开门动态密码（校验成功后生成动态密码通行记录）
     * <desc/>
     *
     * @param checkDTO 动态密码信息
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-27
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/checkDynamicPwd", method = RequestMethod.POST)
    public Boolean checkDynamicPwd(@RequestBody CloudIntercomDynamicPwdCheckDTO checkDTO) throws Exception {
        return iCloudIntercomService.checkDynamicPwd(checkDTO);
    }

    /**
     * <desc>
     * 获取云对讲设备需要展示的多媒体信息
     * <desc/>
     *
     * @param getDTO 获取云对讲多媒体展示信息
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-22
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceMedias", method = {RequestMethod.POST})
    public List<CloudIntercomMediaVO> getDeviceMedias(@RequestBody CloudIntercomMediaGetDTO getDTO) throws Exception {
        return iCloudIntercomService.getDeviceMedias(getDTO);
    }

    /**
     * <desc>
     * 获取云对讲设备状态（1:可用  2:禁用）
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-23
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceState", method = {RequestMethod.POST})
    public Integer getDeviceState(@RequestParam("sn") String sn) throws Exception {
        return iCloudIntercomService.getDeviceState(sn);
    }

    /**
     * <desc>
     * 获取云对讲设备二维码
     * <desc/>
     *
     * @param sn
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-23
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceQrcodeUrl", method = {RequestMethod.POST})
    public String getDeviceQrcodeUrl(@RequestParam("sn") String sn) throws Exception {
        return iCloudIntercomService.getDeviceQrcodeUrl(sn);
    }

    /**
     * <desc>
     * 获取云对讲轮询命令
     * <desc/>
     *
     * @param getDTO 轮询命令分页
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-25
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceChangeLogOrders", method = {RequestMethod.POST})
    public Page<CloudIntercomChangeLogOrderVO> getDeviceChangeLogOrders(@RequestBody CloudIntercomChangeLogGetDTO getDTO) throws Exception {
        return iCloudIntercomService.getDeviceChangeLogOrders(getDTO);
    }

    /**
     * <desc>
     * 云对讲设备批量完成轮询命名
     * <desc/>
     *
     * @param sn
     * @param ids 轮询命令，多个以英文逗号拼接
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-25
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/finishChangeLogOrders", method = {RequestMethod.POST})
    public Integer finishChangeLogOrders(@RequestParam("sn") String sn,
                                         @RequestParam("ids") String ids) throws Exception {
        return iCloudIntercomService.finishChangeLogOrders(sn, ids);
    }

    /**
     * <desc>
     * 同一项目下，根据userSip获取手机号
     * <desc/>
     *
     * @param projectId 项目编号
     * @param userSips  用户sip，多个以英文逗号拼接
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-25
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getPhoneNoByUserSips", method = {RequestMethod.POST})
    public List<String> getPhoneNoByUserSips(@RequestParam("projectId") String projectId,
                                             @RequestParam("userSips") String userSips) throws Exception {
        return iCloudIntercomService.getPhoneNoByUserSips(projectId, userSips);
    }

    /**
     * <desc>
     * 检查用户是否有权限
     * <desc/>
     *
     * @param sn
     * @param tinyId qq物联id
     * @return
     * @author Chunjian.G
     * @createDate 2017-11-27
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/checkUserByTinyId", method = {RequestMethod.POST})
    public Boolean checkUserByTinyId(@RequestParam("sn") String sn, @RequestParam("tinyId") String tinyId) throws Exception {
        return iCloudIntercomService.checkUserByTinyId(sn, tinyId);
    }

    /**
     * <desc>
     * 获取云对讲人脸识别配置信息
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.X
     * @createDate 2018/05/21
     */
    @RequestMapping(path = "smartCommunity/interface/device/pullDeviceInfo")
    public CloudTalkFaceApplyInfoVO pullDeviceInfo(@RequestParam("sn") String sn) {
        return iCloudIntercomService.pullDeviceInfo(sn);
    }

    /**
     * <desc>
     *      获取云对讲iot信息
     * </desc>
     *
     * @param sn
     * @return
     * @author Qiang.S
     * @createDate 2019/07/16
     */
    @RequestMapping(path = "smartCommunity/interface/device/getCloudTalkIotInfo")
    public CloudTalkIotInfoVO getCloudTalkIotInfo(@RequestParam("sn") String sn) {
        return iCloudIntercomService.getCloudTalkIotInfo(sn);
    }

    /**
     * <desc>
     * 根据SN号获取设备待机界面图片
     * <desc/>
     *
     * @param sn
     * @return
     * @author Juguang.S
     * @createDate 2018-08-09
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/pullStandbyInterfacePicture")
    public String getStandbyInterfacePicture(@RequestParam("sn") String sn) {
        return iCloudIntercomService.getStandbyInterfacePicture(sn);
    }

    /**
     * <desc>
     * 云对讲上报设备的能力集信息
     * <desc/>
     *
     * @param sn
     * @param capacitySet 表示设备支持哪些功能，有哪些能力 json String数据
     * @return
     * @author Juguang.S
     * @createDate 2018-08-09
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/reportCapacitySet")
    public void reportCapacitySet(@RequestParam("capacitySet") String capacitySet, @RequestParam("sn") String sn) {
        iCloudIntercomService.reportCapacitySet(capacitySet, sn);
    }

    /**
     * <desc>
     * 获取云对讲设备更新信息
     * </desc>
     *
     * @param sn
     * @param filePackage 安装文件 包名
     * @param versionCode 安装文件 版本号
     * @param deviceType  软件类型 0安卓APK程序，1安卓系统固件，2按键单片机固件
     * @return
     * @author Qiang.S
     * @createDate 2018/08/30
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/deviceIntercomUpdate")
    public CloudDeviceUpdateInfoVO deviceIntercomUpdate(@RequestParam("sn") String sn,
                                                        @RequestParam(value = "filePackage",required = false) String filePackage,
                                                        @RequestParam("versionCode") String versionCode,
                                                        @RequestParam("deviceType") String deviceType) {
        return iCloudIntercomService.deviceIntercomUpdate(sn, filePackage, versionCode, deviceType);
    }

    /**
     * <desc>
     * 根据roomId projectId判定该房间下的业主是否被冻结
     * </desc>
     *
     * @param roomId    房间ID
     * @param projectId 项目ID
     * @return
     * @author Juguang.S
     * @createDate 2018/11/22
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getUserStatusProject")
    public Integer getUserStatusProject(@RequestParam("roomId") String roomId,
                                        @RequestParam("projectId") String projectId) {
        return iCloudIntercomService.getUserStatusProject(roomId, projectId);

    }

    /**
     * <desc>
     * 获取单元代号
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.x
     * @createDate 2018/11/27
     */
    @Override
    @PostMapping(path = "smartCommunity/interface/device/getUnitAlias")
    public List<Map<String, Object>> getUnitAlias(@RequestParam("sn") String sn) {
        return iCloudIntercomService.getUnitAlias(sn);
    }

    /**
     * <desc>
     *      通过百度id来校验该百度Id是否未绑定过百度授权码
     * <desc/>
     *
     * @param baiduId 百度指纹码
     * @return
     * @author Juguang.S
     * @createDate 2019/03/12
     */
    @Override
    @PostMapping(path = "smartCommunity/interface/device/getBaiduIdBingStatus")
    public Integer getBaiduIdBingStatus(@RequestParam("baiduId")String baiduId) {
        return iCloudIntercomService.getBaiduIdBingStatus(baiduId);
    }

    /**
     * <desc>
     *      根据deviceUnique查询该设备是否已绑定或已购买
     * <desc/>
     *
     * @param deviceUnique 设备唯一码
     * @return
     * @author Juguang.S
     * @createDate 2019/03/12
     */
    @Override
    @PostMapping(path = "smartCommunity/interface/device/getDeviceBuyOrBingStatus")
    public Integer getDeviceBuyOrBingStatus(@RequestParam("deviceUnique") String deviceUnique) {
        return iCloudIntercomService.getDeviceBuyOrBingStatus(deviceUnique);
    }

    /**
     * <desc>
     * 通过百度指纹码绑定百度识别码来完成离线人脸识别
     * <desc/>
     *
     * @param sn
     * @param baiduId 百度指纹码
     * @return
     * @author Juguang.S
     * @createDate 2019/02/26
     */
    @Override
    @PostMapping(path = "smartCommunity/interface/device/bingBaiduCode")
    public String getBaiduCode(@RequestParam("sn") String sn, @RequestParam("baiduId") String baiduId) throws Exception {
        return iCloudIntercomService.getBaiduCode(sn, baiduId);
    }

    /**
     * <desc>
     * 根据设备编号获取访客信息
     * </desc>
     *
     * @param deviceUnique 设备唯一码
     * @param smartType    云对讲类型，31-门口机，32-围墙机
     * @return
     * @author Qiang.S
     * @createDate 2019/02/28
     */
    @Override
    @PostMapping(path = "smartCommunity/interface/device/getVisitorInfoByUnique")
    public List<CloudIntercomVisitorVO> getVisitorInfoByUnique(@RequestParam("deviceUnique") String deviceUnique, @RequestParam("smartType") Integer smartType) {
        return iCloudIntercomService.getVisitorInfoByUnique(deviceUnique, smartType);
    }

    /**
     * <desc>
     *     通知云端升级失败原因
     * </desc>
     *
     * @param sn
     * @param id 轮询命令
     * @param msg 失败原因
     * @return 受影响的行数
     * @throws Exception
     * @author Qiang.S
     * @createDate 2019-08-12
     */
    @Override
    @PostMapping(path = "smartCommunity/interface/device/reportUpdateResult")
    public Integer reportUpdateResult(@RequestParam("sn") String sn,
                                      @RequestParam("id") String id,
                                      @RequestParam("msg") String msg) throws Exception {
        return iCloudIntercomService.reportUpdateResult(sn, id, msg);
    }

    /**
     * <desc>
     *      云对讲iot开门
     * </desc>
     *
     * @param userId 用户编号
     * @param sipAccount sip帐号
     * @param message 指令相关信息
     * @param timeout 开门时长
     * @return
     * @author Qiang.S
     * @createDate 2019/07/16
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/iotOpenDoor")
    public void iotOpenDoor(@RequestParam("userId") String userId, @RequestParam("sipAccount") String sipAccount,
                                                               @RequestParam("message") String message, @RequestParam("timeout") String timeout) {
        iCloudIntercomService.iotOpenDoor(userId, sipAccount, message, timeout);
    }

    /**
     * <desc>
     *      云对讲iot云对讲iot音视频切换
     * </desc>
     *
     * @param sipAccount sip帐号
     * @param message 指令相关信息
     * @return
     * @author Qiang.S
     * @createDate 2019/07/16
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/switchVideo")
    public void switchVideo(@RequestParam("sipAccount") String sipAccount, @RequestParam("message") String message) {
        iCloudIntercomService.switchVideo(sipAccount, message);
    }

    /**
     * <desc>
     *      根据sip帐号获取设备编号云对讲
     * </desc>
     *
     * @param sipAccount sip帐号
     * @return
     * @author Qiang.S
     * @createDate 2019/07/22
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getDeviceUniqueBySip")
    public String getDeviceUniqueBySip(@RequestParam("sipAccount") String sipAccount) {
        return iCloudIntercomService.getDeviceUniqueBySip(sipAccount);
    }

    /**
     * <desc>
     *      获取云对讲黑名单
     * </desc>
     *
     * @param sn
     * @param page
     * @param pageSize
     * @return
     * @author Jiaqi.X
     * @createDate 2019/10/14
     */
    @RequestMapping(path = "smartCommunity/interface/device/pullBlackList",method = {RequestMethod.POST})
    public DeviceBlackListPageVO<BlackListVO> pullBlackList(@RequestParam("sn") String sn,@RequestParam("page") String page,
                                                     @RequestParam("pageSize") String pageSize) {
        return iCloudIntercomService.pullBlackList(sn, page, pageSize);
    }

    /**
     * <desc>
     *      获取门禁、联动器临时权限
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.X
     * @createDate 2019/09/11
     */
    @RequestMapping(path = "smartCommunity/interface/device/getTempAuths",method = {RequestMethod.POST})
    public DeviceAuthTempPageVO<EntranceTempAuthVO> getTempAuths(@RequestParam("sn") String sn,@RequestParam("currentPage") String currentPage,
                                                                 @RequestParam("pageSize")String pageSize) throws Exception{
        return iCloudIntercomService.getTempAuths(sn,currentPage,pageSize);
    }

    /**
     * <desc>
     *      根据sn获取该设备所对应批次号的云服务过期时间
     * </desc>
     *
     * @param sn
     * @return
     * @author Juguang.S
     * @createDate 2019/11/26
     */
    @Override
    @RequestMapping(path = "smartCommunity/interface/device/getEndTimeBySn")
    public String getEndTimeBySn(@RequestParam("sn") String sn){
        return iCloudIntercomService.getEndTimeBySn(sn);
    }

    /**
     * <desc>
     * 获取云对讲地址信息
     * </desc>
     *
     * @param deviceUnique
     * @return
     * @author Jiaqi.X
     * @createDate 2019/10/14
     */
    @Override
    public Map<String, Object> getAddressByDeviceUnique(String deviceUnique) {
        return iCloudIntercomService.getAddressByDeviceUnique(deviceUnique);
    }


}
